1. Field of the Invention
The instant disclosure relates to an encoding method and a decoding method for two-dimensional (2D) barcodes and an electronic device; in particular, to an encoding method that encodes at least one one-dimensional (1D) barcode into a 2D barcode, a corresponding decoding method, and an electronic device to execute the methods.
2. Description of Related Art
The one-dimensional (1D) barcode is an optical, machine-readable, representation of data by varying the widths and spaces of parallel lines, and can be read quickly by a scanner. The 1D barcode has a high reliability, and is commonly used for data identification. The commonly used 1D barcodes are, for example, Code 39, Code 128, Code 11, Code 25, UPC-A, UPC-E, EAN-13, EAN-8, Code-B, CodaBar, ITF, Matrix 25, MSI, ISBN, ISSN and the like. However, the amount of information fit into a 1D barcode usually needs to be less than fifteen characters. Thus, the 1D barcode has a limited capability to have data written in, and if a user wants more details about the information indicated by the 1D barcode, he/she needs to find them in some database through the Internet.
The two-dimensional (2D) barcode is another type of machine-readable optical barcode, which is usually used to display text to the user, to open a Uniform Resource Identifier (URI) for linking a website and/or downloading digital contents, making item identification and commercial trade. The 2D barcodes are, for example, QR code, PDF 471, Data Matrix and the like. Compared with the 1D barcode, the 2D barcode can carry more data but still has its limitations. For the QR code, it can have at most 7,089 characters for numbers, at most 4,296 characters for alphanumeric, or at most 2,953 bytes for binary numbers, but excluding images. Moreover, if the 2D barcode has more data, its file size will increase, which makes it hard to be recognized in an optical way. Furthermore, a common decoding process for a 2D barcode must comprise: 1) adjusting the focus to capture a 2D barcode by an optical device, such as a CCD or a CMOS; 2) recognizing the 2D barcode by a recognition program; and 3) decoding the 2D barcode to generate a result.
From the above, how to make a 2D barcode carry more data types, e.g. 1D barcode image, without being hard to recognize and being a huge file for transmitting, is significant. Additionally, if there is no optical device needed for adjusting the focus to capture a 2D barcode, the decoding will take less time.